package com.lm.activiti.boot.cases;

/**
 * @author lm_jcf
 * @date 2020/2/21 9:32
 */
public class ThreadTest {

    public static volatile Integer sign = 0;

    public static void main(String[] args) {

        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    synchronized (sign){
                        sign++;
                        System.out.println(" " + sign);
                    }
                }
            }
        }).start();


        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    synchronized (sign){
                        sign++;
                        System.out.println(" " + sign);
                    }
                }
            }
        }).start();
    }
}
